package test

/**
 * Created by bigbully on 15/3/5.
 */
object MyMonoids extends App{

  def stringMonoid = new Monoid[String] {
    override def op(a1: String, a2:String): String = a1 + a2

    override def zero: String = ""
  }

  def listMonoid[A] = new Monoid[List[A]] {
    def op(a1: List[A], a2: List[A]) = a1 ++ a2
    def zero = Nil
  }
}
trait Monoid[A] {
  def op(a1: A, a2: A): A
  def zero: A
}
